#pragma once

#include "ClearStructuralFeatureAction.h"

#include "OutputPin.h"

namespace uml {

ClearStructuralFeatureAction::ClearStructuralFeatureAction(const QString& umlType)
    : StructuralFeatureAction(umlType) {}

void ClearStructuralFeatureAction::fromJson(const QJsonObject& json, QStringList& errorList) {
    if (json.isEmpty()) {
        return;
    }

    StructuralFeatureAction::fromJson(json, errorList);
    result_ = JsonSerializable::create<OutputPin>(json.value("result"), errorList);

}

void ClearStructuralFeatureAction::toJson(QJsonObject& json) {
    StructuralFeatureAction::toJson(json);
    if (result_) {
        QJsonObject result_json;
        result_->toJson(result_json);
        json.insert("result", result_json);
    }
}

/// <summary>
/// result getter
/// The OutputPin on which is put the input object as modified by the
/// ClearStructuralFeatureAction.
/// </summary>
shared_ptr<OutputPin> ClearStructuralFeatureAction::result() const {
    return result_;
}

/// <summary>
/// result setter
/// The OutputPin on which is put the input object as modified by the
/// ClearStructuralFeatureAction.
/// </summary>
void ClearStructuralFeatureAction::setResult(shared_ptr<OutputPin> value) {
    result_ = value;
}

} // namespace uml
